{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e6cf6f89-7a59-4faa-a9e5-8376068b3a2e",
   "metadata": {},
   "source": [
    "# Python科学数据处理"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0b508204-9fe8-4d09-97b5-3cfaad693168",
   "metadata": {},
   "source": [
    "# 数据量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "2fe8b3e9-bf30-4038-94a3-586aa4f43815",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "47185920.0\n"
     ]
    }
   ],
   "source": [
    "print((720*2**50)/(16*2**30))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "508be472-5fa0-4062-990e-5acc2c6963c3",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6f500760-f95e-4097-afc1-5311f44e3bd3",
   "metadata": {},
   "outputs": [],
   "source": [
    "## numpy\n",
    "list\n",
    "tuple\n",
    "Dict\n",
    "Set\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "929138d3-f9c9-42cd-a058-bc204f98252e",
   "metadata": {},
   "source": [
    "Python 保存数据的方法有什么？\n",
    "* list\n",
    "* tuple\n",
    "* Dict\n",
    "* Set"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "88dec3dc-a8ff-488c-b66b-95590b14d2cf",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'numpy.ndarray'>\n"
     ]
    }
   ],
   "source": [
    "a = [[1,2,3,4],[5,6,7,8]]\n",
    "b = np.array(a)\n",
    "print(type(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "0b9594f7-96ba-4422-83be-590821f3810a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2, 4)"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "6214529c-58df-4ad9-8c5d-01bb9097f815",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 2, 3, 4])"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "2e5b1469-5581-4460-bbf1-2c3b18b6c9f1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2, 3, 4],\n",
       "       [5, 6, 7, 8]])"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "3fc3b906-a8bc-418e-b574-61b09f86b01a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b[1,2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "e31356ff-0f27-4bfd-a9c7-ce4e93457277",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3],\n",
       "       [ 4,  5,  6,  7],\n",
       "       [ 8,  9, 10, 11],\n",
       "       [12, 13, 14, 15]])"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = np.arange(16)\n",
    "a = a.reshape(4,4)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "e6ad1fab-a3ae-447b-aad4-c2d06c506727",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[ 0,  1,  2,  3],\n",
       "        [ 4,  5,  6,  7],\n",
       "        [ 8,  9, 10, 11],\n",
       "        [12, 13, 14, 15]],\n",
       "\n",
       "       [[16, 17, 18, 19],\n",
       "        [20, 21, 22, 23],\n",
       "        [24, 25, 26, 27],\n",
       "        [28, 29, 30, 31]],\n",
       "\n",
       "       [[32, 33, 34, 35],\n",
       "        [36, 37, 38, 39],\n",
       "        [40, 41, 42, 43],\n",
       "        [44, 45, 46, 47]],\n",
       "\n",
       "       [[48, 49, 50, 51],\n",
       "        [52, 53, 54, 55],\n",
       "        [56, 57, 58, 59],\n",
       "        [60, 61, 62, 63]]])"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = np.arange(64)\n",
    "a = a.reshape(4,4,4)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "b5c63763-2d8c-496b-8329-7aa08a49730f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "38"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[2,1,2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "30da3ecb-092a-4924-81c2-c798fee205d4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 0  1  2  3]\n",
      " [ 4  5  6  7]\n",
      " [ 8  9 10 11]\n",
      " [12 13 14 15]\n",
      " [16 17 18 19]\n",
      " [20 21 22 23]\n",
      " [24 25 26 27]\n",
      " [28 29 30 31]\n",
      " [32 33 34 35]\n",
      " [36 37 38 39]\n",
      " [40 41 42 43]\n",
      " [44 45 46 47]\n",
      " [48 49 50 51]\n",
      " [52 53 54 55]\n",
      " [56 57 58 59]\n",
      " [60 61 62 63]]\n"
     ]
    }
   ],
   "source": [
    "a = np.arange(64)\n",
    "a = a.reshape(16,4)\n",
    "print(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "id": "80c13676-c39e-4415-9400-68b259869fc3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[24, 25, 26, 27],\n",
       "       [28, 29, 30, 31],\n",
       "       [32, 33, 34, 35],\n",
       "       [36, 37, 38, 39]])"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[6:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "id": "8ec72f68-b42a-4f21-8a60-053ac1ca3bd8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[25, 26],\n",
       "       [29, 30],\n",
       "       [33, 34],\n",
       "       [37, 38]])"
      ]
     },
     "execution_count": 122,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[6 : 10 , 1 : 3 ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "id": "6a93eee6-6fa7-446c-93fe-568b3ce1ce96",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[[  0   1   2   3]\n",
      "  [  4   5   6   7]\n",
      "  [  8   9  10  11]\n",
      "  [ 12  13  14  15]\n",
      "  [ 16  17  18  19]\n",
      "  [ 20  21  22  23]\n",
      "  [ 24  25  26  27]\n",
      "  [ 28  29  30  31]\n",
      "  [ 32  33  34  35]\n",
      "  [ 36  37  38  39]\n",
      "  [ 40  41  42  43]\n",
      "  [ 44  45  46  47]\n",
      "  [ 48  49  50  51]\n",
      "  [ 52  53  54  55]\n",
      "  [ 56  57  58  59]\n",
      "  [ 60  61  62  63]]\n",
      "\n",
      " [[ 64  65  66  67]\n",
      "  [ 68  69  70  71]\n",
      "  [ 72  73  74  75]\n",
      "  [ 76  77  78  79]\n",
      "  [ 80  81  82  83]\n",
      "  [ 84  85  86  87]\n",
      "  [ 88  89  90  91]\n",
      "  [ 92  93  94  95]\n",
      "  [ 96  97  98  99]\n",
      "  [100 101 102 103]\n",
      "  [104 105 106 107]\n",
      "  [108 109 110 111]\n",
      "  [112 113 114 115]\n",
      "  [116 117 118 119]\n",
      "  [120 121 122 123]\n",
      "  [124 125 126 127]]\n",
      "\n",
      " [[128 129 130 131]\n",
      "  [132 133 134 135]\n",
      "  [136 137 138 139]\n",
      "  [140 141 142 143]\n",
      "  [144 145 146 147]\n",
      "  [148 149 150 151]\n",
      "  [152 153 154 155]\n",
      "  [156 157 158 159]\n",
      "  [160 161 162 163]\n",
      "  [164 165 166 167]\n",
      "  [168 169 170 171]\n",
      "  [172 173 174 175]\n",
      "  [176 177 178 179]\n",
      "  [180 181 182 183]\n",
      "  [184 185 186 187]\n",
      "  [188 189 190 191]]\n",
      "\n",
      " [[192 193 194 195]\n",
      "  [196 197 198 199]\n",
      "  [200 201 202 203]\n",
      "  [204 205 206 207]\n",
      "  [208 209 210 211]\n",
      "  [212 213 214 215]\n",
      "  [216 217 218 219]\n",
      "  [220 221 222 223]\n",
      "  [224 225 226 227]\n",
      "  [228 229 230 231]\n",
      "  [232 233 234 235]\n",
      "  [236 237 238 239]\n",
      "  [240 241 242 243]\n",
      "  [244 245 246 247]\n",
      "  [248 249 250 251]\n",
      "  [252 253 254 255]]]\n"
     ]
    }
   ],
   "source": [
    "a = np.arange(256)\n",
    "a = a.reshape(4,16,4)\n",
    "print(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 156,
   "id": "f544e8a5-cd1e-4620-b2df-bd6317c41c03",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[ 5,  6],\n",
       "        [13, 14],\n",
       "        [21, 22],\n",
       "        [29, 30]]])"
      ]
     },
     "execution_count": 156,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[0:1,1:8:2,1:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "id": "969069ec-9005-4277-bdf3-9c8c9e14003c",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[  1,   2],\n",
       "        [  5,   6],\n",
       "        [  9,  10],\n",
       "        [ 13,  14],\n",
       "        [ 17,  18],\n",
       "        [ 21,  22],\n",
       "        [ 25,  26],\n",
       "        [ 29,  30],\n",
       "        [ 33,  34],\n",
       "        [ 37,  38],\n",
       "        [ 41,  42],\n",
       "        [ 45,  46],\n",
       "        [ 49,  50],\n",
       "        [ 53,  54],\n",
       "        [ 57,  58],\n",
       "        [ 61,  62]],\n",
       "\n",
       "       [[ 65,  66],\n",
       "        [ 69,  70],\n",
       "        [ 73,  74],\n",
       "        [ 77,  78],\n",
       "        [ 81,  82],\n",
       "        [ 85,  86],\n",
       "        [ 89,  90],\n",
       "        [ 93,  94],\n",
       "        [ 97,  98],\n",
       "        [101, 102],\n",
       "        [105, 106],\n",
       "        [109, 110],\n",
       "        [113, 114],\n",
       "        [117, 118],\n",
       "        [121, 122],\n",
       "        [125, 126]],\n",
       "\n",
       "       [[129, 130],\n",
       "        [133, 134],\n",
       "        [137, 138],\n",
       "        [141, 142],\n",
       "        [145, 146],\n",
       "        [149, 150],\n",
       "        [153, 154],\n",
       "        [157, 158],\n",
       "        [161, 162],\n",
       "        [165, 166],\n",
       "        [169, 170],\n",
       "        [173, 174],\n",
       "        [177, 178],\n",
       "        [181, 182],\n",
       "        [185, 186],\n",
       "        [189, 190]],\n",
       "\n",
       "       [[193, 194],\n",
       "        [197, 198],\n",
       "        [201, 202],\n",
       "        [205, 206],\n",
       "        [209, 210],\n",
       "        [213, 214],\n",
       "        [217, 218],\n",
       "        [221, 222],\n",
       "        [225, 226],\n",
       "        [229, 230],\n",
       "        [233, 234],\n",
       "        [237, 238],\n",
       "        [241, 242],\n",
       "        [245, 246],\n",
       "        [249, 250],\n",
       "        [253, 254]]])"
      ]
     },
     "execution_count": 178,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[0:4,0:16,1:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 202,
   "id": "803bebaa-c45c-49a0-be01-a437a690fb4b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQgJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAEsASwDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD5/ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigCe1tJLyUxxNCrBd2Zp0iGPq5Azz0qCiilrcWtwooopjCiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2Q==",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAIAAAD2HxkiAAAEvUlEQVR4Ae3RsQEAAAQEMfYfmuqXIJqvL6ocAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQI3Bfpm1p+qSapPRsISIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAhEYAF77QECO+PfCgAAAABJRU5ErkJggg==",
      "text/plain": [
       "<PIL.Image.Image image mode=RGB size=300x300>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "from PIL import Image\n",
    "\n",
    "# im = np.random.randint(0,255, (100,300,3), dtype=np.uint8)\n",
    "\n",
    "im = np.zeros( (300,300,3), dtype=np.uint8) \n",
    "im[150,150]=(0,255,0)\n",
    "im[150,149]=(0,255,0)\n",
    "im[150,151]=(0,255,0)\n",
    "\n",
    "im = Image.fromarray(im)\n",
    "\n",
    "display(im)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 234,
   "id": "605ddb57-f6ed-4945-85d8-f9f6047f1d3a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQgJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAGQAZADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD5/ooqeONJ4wiDE46D/np7f73t3+vVN2LhBzdlv+f9f1qQUUUUyAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigCz/AMfv/X1/6N/+y/n9fvVqKs/8fv8A19f+jf8A7L+f1+9Hw+h0fxv8X5/8H8/XetRRRVnOFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAWf8Aj9/6+v8A0b/9l/P6/erUVZ/4/f8Ar6/9G/8A2X8/r96Ph9Do/jf4vz/4P5+u9aiiirOcKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAs/8AH7/19f8Ao3/7L+f1+9Woqz/x+/8AX1/6N/8Asv5/X70fD6HR/G/xfn/wfz9d61FFFWc4UUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQBZ/4/f+vr/wBG/wD2X8/r96tRVn/j9/6+v/Rv/wBl/P6/ej4fQ6P43+L8/wDg/n671qKKKs5wooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigCz/x+/wDX1/6N/wDsv5/X71airP8Ax+Bj/wAvCqWY/wDPQAZJ/wB4AZ9/r1j4fQ6P43+L8/8Ag/n671qKKKs5wooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigCz/x+Bj/AMvCqWY/89ABkn/eAGff69a1FWf+PwMf+XhVLMf+egAyT/vADPv9esfD6HR/G/xfn/wfz9d61FFFWc4UUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQBZ/wCPwMf+XhVLMf8AnoAMk/7wAz7/AF61qKs/8fgY/wDLwqlmP/PQAZJ/3gBn3+vWPh9Do/jf4vz/AOD+frvWoooqznCiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKALP/H4GP/LwqlmP/PQAZJ/3gBn3+vWtRVn/AI/f+vr/ANG//Zfz+v3o+H0Oj+N/i/P/AIP5+u9aiiirOcKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAs/8fv/AF9f+jf/ALL+f1+9Woqz/wAfv/X1/wCjf/sv5/X70fD6HR/G/wAX5/8AB/P13rUUUVZzhRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAFn/j9/6+v/Rv/wBl/P6/erUVZ/4/f+vr/wBG/wD2X8/r96Ph9Do/jf4vz/4P5+u9aiiirOcKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAsn/TNuP8Aj653f9NOmMerdfrgdSea1FWf+P3/AK+v/Rv/ANl/P6/ej4fQ6P43+L8/+D+frvWoooqznCiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKALJ/0zbj/j653f8ATTpjHq3X64HUnmtRVn/j9/6+v/Rv/wBl/P6/ej4fQ6P43+L8/wDg/n671qKKKs5wooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigCyf8ATNuP+Prnd/006Yx6t1+uB1J5rUVZ/wCP3/r6/wDRv/2X8/r96Ph9Do/jf4vz/wCD+frvWoooqznCiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKALJ/0zbj/j653f9NOmMerdfrgdSea1FWf+P3/r6/8ARv8A9l/P6/ej4fQ6P43+L8/+D+frvWoooqznCiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKALJ/0zbj/AI+ud3/TTpjHq3X64HUnmtRVn/j9/wCvr/0b/wDZfz+v3o+H0Oj+N/i/P/g/n671qKKKs5wooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigCyf9M24/4+ud3/AE06Yx6t1+uB1J5rUVZ/4/f+vr/0b/8AZfz+v3o+H0Oj+N/i/P8A4P5+u9aiiirOcKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAs/8fv8A19f+jf8A7L+f1+9Woqz/AMfv/X1/6N/+y/n9fvR8PodH8b/F+f8Awfz9d61FFFWc4UUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQBZ/4/f8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9PBAhkC+is7HxMR4DAFNBZ08MTAQLZAjorOx/TESAwBXTW9PBEgEC2gM7Kzsd0BAhMAZ01PTwRIJAtoLOy8zEdAQJTQGdND08ECGQL6KzsfExHgMAU0FnTwxMBAtkCOis7H9MRIDAFdNb08ESAQLaAzsrOx3QECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBD4ksD/B68WET8bcl8AAAAASUVORK5CYII=",
      "text/plain": [
       "<PIL.Image.Image image mode=RGB size=400x400>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "from PIL import Image\n",
    "\n",
    "# im = np.random.randint(0,255, (100,300,3), dtype=np.uint8)\n",
    "\n",
    "def dot(x,y,color=(255,0,0)):\n",
    "    im[x,y] = color\n",
    "    \n",
    "def line(x1,y1,x2,y2,color):\n",
    "    for x in range(x1,x2+1):\n",
    "        y = int((x- x1)/(x2-x1)*(y2-y1)) + y1\n",
    "        dot(x,y,color)\n",
    "        \n",
    "\n",
    "    \n",
    "im = np.zeros( (400,400,3), dtype=np.uint8) \n",
    "line(10,10,300,300,(255,0,0))\n",
    "\n",
    "im = Image.fromarray(im)\n",
    "\n",
    "display(im)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "e779eaeb-0667-485d-bda3-854fcc7132aa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/wAALCAGQAZABAREA/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/9oACAEBAAA/APn+iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiirkEEd7CsMK7bxfurniceg9H9B0YcD5vvU6KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK0P+Qr/2EP8A0p/+2f8AoX+99/PooooooooooooooooooooooooooooooooooooooooooooooooorWtbaTxFdR28TRLqchwDNMsSXH1ZyFD+5I3f7337X/CG6p/z9aH/AOD2y/8Aj1H/AAhuqf8AP1of/g9sv/j1H/CG6p/z9aH/AOD2y/8Aj1H/AAhuqf8AP1of/g9sv/j1H/CG6p/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UeKhLjTtCITW3ikSIg7TSsysYVHioS407QiE1t4pEiIO00rMrGFR4qEuNO0IhNbeKRIiDtNKzKxhUeKhLjTtCITW3ikSIg7TSsysYVHioS407QiE1t4pEiIO00rMrGFR4qEuNO0IhNbeKRIiDtNKzKxhUeKhLjTtCITW3ikSIg7TSsysYVHioS407QiE1t4pEiIO00rMrGFR4qEuNO0IhNbeKRIiDtNKzKxhUeKhLjTtCITW3ikSIg7TSsysYVHioS407QiE1t4pEiIO00rMrGFR4qEuNO0IhNbeKRIiDtNKzKxhUeKhLjTtCITW3ikSIg7TSsysYVHioS407QiE1t4pEiIO00rMrGFR4qEuNO0IhNbeKRIiDtNKzKxhUeKhLjTtCITW3ikSIg7TSsysYVHioS407QiE1t4pEiIO00rMrGFR4qEuNO0IhNbeKRIiDtNKzKxhUeKhLjTtCITW3ikSIg7TSsysYVHioS407QiE1t4pEiIO00rMrGFR4qEuNO0IhNbeKRIiDtNKzKxhUeKhLjTtCITmyMCBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAIG/Ai8QoJICNcziOgAAAABJRU5ErkJggg==",
      "text/plain": [
       "<PIL.Image.Image image mode=L size=400x400>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "from PIL import Image\n",
    "\n",
    "# im = np.random.randint(0,255, (100,300,3), dtype=np.uint8)\n",
    "def dot(x, y, color ):\n",
    "        im[y, x] = color\n",
    "\n",
    "def line(x1, y1, x2, y2, color):\n",
    "    for x in range(x1, x2+1):\n",
    "    \n",
    "        y = int((x-x1)/(x2-x1)*(y2-y1)+0.5) + y1\n",
    "        dot(x,y,color)\n",
    "\n",
    "def circle(x,y,r,color):\n",
    "    pass\n",
    "\n",
    "#circle(400,400,100,(255,0,0))\n",
    "\n",
    "\n",
    "im = np.zeros( (400,400), dtype=np.uint8) \n",
    "\n",
    "line(10,10,300,300,128)\n",
    "line(30,30,310,30,255)\n",
    "\n",
    "\n",
    "im = Image.fromarray(im)\n",
    "\n",
    "display(im)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "id": "5c04ee5a-3534-4371-b0ae-3385d405fed6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQgJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAGQAZADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD5/ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoorpPCngPxH4zuAmjadJJAH2yXcnyQR8rnLngkBgdoy2OQDQBzdFfSfhf8AZ10ixdLjxJqEmpvsUm1gBhiDFTuBYHe4BIII2fd5BzivWNE8N6L4ct/I0bS7SxQoiOYYgrSBRhd7dXIyeWJPJ9aAPkDTfhj431W4aC38Makjqhcm6hNuuMgcNJtBPPTOevoa6yx/Z58a3dnHPNLpVlI2cwT3DF0wSOSiMvPXgnr68V9T0UAfMH/DOPjD/oJaH/3/AJv/AI1Uk/7N/ipbiVbfVdGkgDkRvJJKjMueCVCEA47ZOPU19N0UAfLk/wCzr4yht5ZUu9GndELLFHcSBnIH3RujAyenJ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Jy3LfMSTzjOMAcvQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABXoHg34w+KfCHlW32n+0tMTC/Y7ti2xRtGI3+8mFXAHKjJO015/RQB9Z+F/jn4Q8QulvdzSaPdlFJW+KrEW2ksFlBxgYxl9ucjAycD0iCeG6t4ri3ljmglQPHJGwZXUjIII4II5zXwJWhpmu6xonm/2Tqt9YedjzPslw8W/GcZ2kZxk9fU0Afd9FfJmm/Hnx5Y3DS3F9aaghQqIrq0RVByPmHl7DnjHXHJ46Y6yx/aXvI7ONb/wxBPdDO+SC8MSNycYUoxHGP4j68dKAPoeivn/AP4aa/6lH/ypf/aqkn/aZhW4lW38KSSQByI3kvwjMueCVEZAOO2Tj1NAHvlFfPk/7TMzW8q2/hSOOcoRG8l+XVWxwSojBIz2yM+ork9T+P3jm/8AK+zXFjpuzO77JahvMzjGfNL9MdsdTnPGAD6vrz/xJ8Z/BXhzy1/tL+1JnwfL0zbPtU55Lbgg5HTdu5Bxg5r5Y1nxX4g8Q7xq+tX17G0pm8madjGrnPKpnavUgYAwDgcVj0AeoeLvjp4p8R7rfTX/ALEsTj5LSQmZvunmXAI5B+6F4Yg5ry+iigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigD/2Q==",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAIAAAAP3aGbAAAPF0lEQVR4Ae3b0XKjuhIF0OT+/z/nnqSmZiA2NkjdLQFrnmxALXm12FCpmo8P/wgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQuKTA19fXJX+XHzVW4HPs9GY/l0BSDH1+2ofn2gjDVmujDKM/xcR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qIqlc605zzhjVNK94txB31Tqj9PNt2u9qR3rBqvSNm86oVofinhqgKxCwo5Q2rADl4CvdYFCjJKMmyOt6wyqjjJ/Kq1Wwqqprpxg70hjXWv2t2d10bH7c2txlGecOaoQu9a/CqtVNQVO2EmvYygTVtaw4vTGy9IBNVL3BOdEpgnahZu5Yqtn4xiapfIKf+KrBO3b7NxYut/2hE1eb+OO0JgXXa1u1Y+G1jS1Tt2B2nvERgnbJthxZ9q9gSVYf2xukuFlina1n7gi+cXHKqfVucaqTAOlW7IhZ7sdgSVRGb4jQ1BNZpWhW+0FMnl5wK3w+nKCiwTtGm3EWeKLnkVO5WmL66wJq+RbULnDC8hFTtFph6NoE1dXuGL25Ifkmo4X2fdgECa9rWzLiwpPySUDM225oI3EcgKdruA+iXEiBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgMDdBP4PMaZmdeBlU80AAAAASUVORK5CYII=",
      "text/plain": [
       "<PIL.Image.Image image mode=RGB size=400x400>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#实心圆\n",
    "import numpy as np\n",
    "from PIL import Image\n",
    "im = np.zeros( (400,400,3), dtype=np.uint8)\n",
    "import math\n",
    "def dot(x, y, color ):\n",
    "        im[y, x] = color\n",
    "\n",
    "def circle(r, x1, y1, color): \n",
    "    for i in range(-r, r + 1):\n",
    "        for j in range(-r,r + 1):\n",
    "            if i**2 + j**2 <= r**2: \n",
    "                dot(x1 + i, y1 + j, color)\n",
    "circle(100,200,200,(255,255,255))\n",
    "im = Image.fromarray(im)\n",
    "display(im)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "d82ddfbb-7e31-4d2d-8092-8746b82c54e5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQgJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAGQAZADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD5/ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoorUTRWgRJ9Snjs4CkUuzKvOySNwUiyDnaGcbioK7TuG9NwBl1csNKvtTfbZ20ko3hGk6IhKs3zuflUbUdiWIACMTwCRYGpWNqXNjpUZcurxy3snntEVkLDCgLGwK7VYOjA4JG3OBTur+8vvI+2Xc9x5ESwQ+dIX8uNfuoueijJwBwKALH9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XfALuSSSxA64AVQqgANS1KbU7hZJFjijjQRwW8QIjgjBJCICScZJJJJJJLMSxJNOiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKuabqU2mXDSRrHLHIhjnt5QTHPGSCUcAg4yAQQQQQGUhgCKdFAGhdafjToNStRutH2xS/vN7QzY5V/lXbu2s68EFcgMzI+M+rmm3kNncMbm0juraVDHNE2FbaSDlHwSjggEMAemCGUspjvrX7FeSW4uILhVwVmgfcjqQCCO4yCOCAw6EAggAFeiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoorU0VFgebUp0jMFoh2+dbNMjTsreUhHC5yC2HO0iNsh8bGAJL7zdFs5NIHnw3kuP7RRtgAwQyRcZYY4Z1JHz4BQNECceiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigArYsW/tezj0maWdrqLI00LH5gZmJJgwql/nY5TBKhyflHmM649FABRWprSLO8OpQJGILtBu8m2aFFnVV81AOVzkhsIdoEi4CZ2Ll0AFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFampA2ul6bYmSQvsa7kjdJEMTS4CjDHaQY44pA6gZEgBJ2jFfSrBtT1S3s1EmJH+dkVSUQcu/zMq4VQWJZlAAJJAyRHf3X27Ubm8+zwW/nyvL5NumyOPcSdqL2UZwB2FAFeiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA1NNButL1KxEkgfYt3HGiSOZWiyGGFO0ARySyF2BwIyARuOcurFhdfYdRtrz7PBceRKkvk3Cb45NpB2uvdTjBHcVJqtg2mapcWbCTEb/IzqoLoeUf5WZcMpDAqzAgggkYJAKdFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAaGleQn22efnyrSTYn7r52fEY/1mem/d8qs3y8bfvpn1qWpMfhrUnSOQO9xbwvMryAeWRI5jYAbCC0aN8xBzGNoPzFcugAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACtDVfIf7FPBx5tpHvT918jJmM/6vHXZu+ZVb5ud333z61LomTw1prvHIXS4uIUmZ5CPLAjcRqCNgAaR2+Uk5kO4D5SwBl0UUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQBoQug8PXqFIDIbuAqzKvmABJshSW3BTkZAUgkLkqQobPrUglYeFdQiFxGqNe2zGAyKGchJwGCbckLkgkMAN4BDbgVy6ACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAK0JnQ+HrJAkAkF3OWZVXzCCkOAxDbiowcAqACWwWJYLn1qSSsnhW2iS4jCS3szSQLIu4lUjCM6BQcfO4UliOXAC/MXAMuiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKANS1Bk8NakiSSF0uLeZ4VSQjywJEMjEHYAGkRfmBOZBtI+YNl1oaV5D/bYJ+PNtJNj/uvkZMSD/WY67NvysrfNxu+4+fQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABWpdAx+GtNR5JA73FxMkLJIB5ZEaCRSTsILRuvygHMZ3E/KFy60NV8hPsUEHPlWke9/3Xzs+ZD/q89N+35mZvl52/cQAz6KKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAuaVftpmqW94pkxG/zqjKC6Hh0+ZWXDKSpDKwIJBBGQY7+1+w6jc2f2iC48iV4vOt33xybSRuRu6nGQe4qvWpqRN1pem3xjkD7GtJJHeRzK0WCpyw2gCOSKMIpOBGCQNwyAZdFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQBYsLX7dqNtZ/aILfz5Ui864fZHHuIG527KM5J7CpNVv21PVLi8YyYkf5FdlJRBwifKqrhVAUBVUAAAADAFjTSbXS9SvhHIX2LaRyI8iGJpcljlRtIMccsZRiMiQkA7TjLoAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAK1NFdZ3m02d4xBdodvnXLQos6q3lOTyuckrlxtAkbJTO9cuigAorYvl/tezk1aGKdrqLB1ItJ5gZmIAnyzF/nY4fIKhyPmHmKi49ABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRWxYr/ZFnHq00U63UuTppWTywrKSDPlWD/IwwmAFLg/MfLZGAI9adYHh02B4zBaIN3k3LTI07KvmuDwucgLlBtIjXBfG9suiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAsWN19ivI7g28Fwq5DQzpuR1IIIPcZBPIIYdQQQCJNSs4bO4UW13HdW0qCSGVcK20kjDpklHBBBUk9MgspVjTrQtdQxp0+m3R3Wj7pYv3e9oZscMnzLt3bVRuSCuCVZkTABn0Vc1LTZtMuFjkaOWORBJBcREmOeMkgOhIBxkEEEAggqwDAgU6ACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooq5pumzancNHG0cUcaGSe4lJEcEYIBdyATjJAAAJJIVQWIBADTbOG8uGFzdx2ttEhkmlbDNtBAwiZBdySAFBHXJKqGYR3119tvJLgW8FurYCwwJtRFAAAHc4AHJJY9SSSSbF1qGdOg021O20TbLL+72NNNjln+Zt23cyLyAFyQqs75z6ACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKANDT7qzGLXUrffaNu/ewoBNCzbfnU8b8bB8jHaQXA2M28R3mmzWdva3JaOW2uUzHNESV3ADehyAQ6kgEH1BGVZWNOrFrfXFl54t5NqzxNDKpUMroexB4OCAw9GVWGCAQAV6K2PsNvrU+dIj8m8ml2ppm4tkbN37pz975gyiNvn+aNQZWJIx6ACiiigAooooAKKKKACiiigAooooAKKK2FsbfSPLm1aPzroSup0ssUZQu5T5xHMfzgDy+HKhuY8ozAFOz02a8t7q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UAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQB//9k=",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAIAAAAP3aGbAAAM40lEQVR4Ae3c0ZLbNgwF0Ez//59bNU5m7bW8tiiSAoiTh8bWShR4LihqMml+/fKLAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAA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AECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAh0FvgPpXMERTZ6KHwAAAAASUVORK5CYII=",
      "text/plain": [
       "<PIL.Image.Image image mode=RGB size=400x400>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#空心圆\n",
    "import numpy as np\n",
    "from PIL import Image\n",
    "im = np.zeros( (400,400,3), dtype=np.uint8)\n",
    "import math\n",
    "def dot(x, y, color ):\n",
    "        im[y, x] = color\n",
    "\n",
    "def circle(r, x1, y1, color): \n",
    "    for i in range(0, 360):\n",
    "        j = np.radians(i) \n",
    "        x = int(x1 + r * np.cos(j))\n",
    "        y = int(y1 + r * np.sin(j))\n",
    "        dot(x, y, color)\n",
    "    \n",
    "   \n",
    "circle(100,200,200,(255,255,255))\n",
    "im = Image.fromarray(im)\n",
    "display(im)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "id": "8c6525b1-1dfd-4698-8284-95f891ef04ef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/jpeg": "/9j/4AA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IiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAKTBP4H+ZhA44lwzdoAAAAASUVORK5CYII=",
      "text/plain": [
       "<PIL.Image.Image image mode=L size=400x400>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#画任意线\n",
    "import numpy as np\n",
    "from PIL import Image\n",
    "im = np.zeros( (400,400), dtype=np.uint8) \n",
    "def dot(x, y, color ):\n",
    "        im[y, x] = color\n",
    "def line(x1, y1, x2, y2, color):\n",
    "    for x in range(x1, x2+1):\n",
    "        if x1 == x2: \n",
    "            for y in range(min(y1, y2), max(y1, y2) + 1):\n",
    "                dot(x1, y, color)\n",
    "        elif y1 == y2: \n",
    "            for x in range(min(x1, x2), max(x1, x2) + 1):\n",
    "                dot(x, y1, color)\n",
    "        else:  \n",
    "            for x in range(min(x1, x2), max(x1, x2) + 1):\n",
    "                y = int((y2 - y1) / (x2 - x1) * (x - x1) + y1 + 0.5)\n",
    "                dot(x, y, color)\n",
    "        \n",
    "line(10,10,300,300,255)\n",
    "line(30,30,310,30,255)\n",
    "line(30,10,30,300,255)\n",
    "\n",
    "\n",
    "\n",
    "im = Image.fromarray(im)\n",
    "\n",
    "display(im)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7b5eea83-ec6a-4d06-87f7-e9fcdd1ea2d3",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
